package principe.inversion.improve;

public class DependencyInversion {
}

//定义接口
interface IReceiver {
    String getInfo();
}

class Email implements IReceiver {

    @Override
    public String getInfo() {
        return "电子邮件信息：Hello Loong!";
    }
}

class WeiXin implements IReceiver {

    @Override
    public String getInfo() {
        return "微信信息：Hello Loong!";
    }
}

//方式2
class Person {
    //对于接口的依赖
    public void receive(IReceiver iReceiver) {
        System.out.println(iReceiver.getInfo());
    }
}
